// pages/mine/mystore/storeinfo.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        store: {
            name: "机油专卖店"
        },
        maskshow: false,
        slideshow: false,
        files: [],
        rangeshow: 0,
        discountshow: 0,
        pricecut: 0,
        time1: "09:00",
        time2: "21:00",
        range: [{
                selected:false,
                name: "普洗"
            },
            {
				selected: false,
                name: "精洗"
            },
            {
				selected: false,
                name: "打蜡"
            }
        ],
        discount: [{
			selected: false,
                name: "中秋嗨动全场6折促销让利"
            },
            {
				selected: false,
                name: "中秋嗨动全场6折促销让利"
            }
        ],
        pricecut: [{
                selected: "",
                name: "满30减10"
            },
            {
                selected: "",
                name: "满50减20"
            },
            {
                selected: "",
                name: "满100减50"
            },
            {
                selected: "",
                name: "满200减120"
            },
        ]

    },
    showrange: function() {
        this.setData({
            slideshow: true,
            maskshow: true,
            rangeshow: 1
        })
    },
    showdiscount: function() {
        this.setData({
            slideshow: true,
            maskshow: true,
            discountshow: 1
        })
    },
    showpricecut: function() {
        this.setData({
            slideshow: true,
            maskshow: true,
            pricecutshow: 1
        })
    },
    slideclose: function() {
        this.setData({
            slideshow: false,
            maskshow: false,
            rangeshow: 0,
            discountshow: 0,
            pricecutshow: 0
        })
    },
	cancelbtn:function(){
		this.setData({
			slideshow: false,
			maskshow: false,
			rangeshow: 0,
			discountshow: 0,
			pricecutshow: 0
		})
	},
    time1picker: function(e) {
        this.setData({
            time1: e.detail.value
        })
    },
    time2picker: function(e) {
        this.setData({
            time2: e.detail.value
        })
    },
    chooseImage: function(e) {
        var that = this;
        wx.chooseImage({
            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: function(res) {
                // 返回选定照片的本地文件路径列表，tempFilePath可以作为img标签的src属性显示图片
                that.setData({
                    files: that.data.files.concat(res.tempFilePaths)
                });
            }
        })
    },
    previewImage: function(e) {
        wx.previewImage({
            current: e.currentTarget.id, // 当前显示图片的http链接
            urls: this.data.files // 需要预览的图片http链接列表
        })
    },
    delimage: function(e) {
        var that = this
        let index = e.currentTarget.dataset.id
        let files = that.data.files
        files.splice(index, 1)
        that.setData({
            files: files,
        })
    },
    delrange: function(e) {
        let range = this.data.range
		let index = e.currentTarget.dataset.index
		range.splice(index, 1)
		this.setData({
			range: range
		})

    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {},

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    }
})